import { getCreateList } from '@/api/common';

/**
 * 企微朋友圈列的配置项
 */
export const qwFirendSearchOption = [
    {
        label: '任务名称',
        name: 'title',
        value: '',
        type: 'input',
        placeholder: '请输入任务名称'
    },
    {
        label: '任务状态',
        name: 'status',
        value: '',
        // multiple: true,
        type: 'select',
        placeholder: '全部状态',
        optionList: [
            { label: '待下发', value: 1 },
            { label: '已下发', value: 2 },
            { label: '已结束', value: 3 }
        ]
    },
    {
        label: '下发时间',
        name: 'created_at',
        value: [],
        type: 'datePicker',
        datePickerType: 'daterange',
        datePickerFormat: 'YYYY-MM-DD',
        valueFormat: 'YYYY-MM-DD HH:mm:ss',
        startPlaceholder: '开始日期',
        endPlaceholder: '结束日期'
    },
    {
        label: '创建人',
        name: 'created_uid',
        value: [],
        multiple: true,
        type: 'select',
        filterable: true,
        placeholder: '请选择创建人',
        fetchOptionApi: () => {
            return new Promise(resolve => {
                getCreateList({}).then((res: any) => {
                    const targetArr = res.map((item: any) => {
                        item.name = `${item.name}  (${item.phone}) `;
                        return item;
                    });
                    resolve(targetArr);
                });
            });
        },
        formatOption: (v: any) => ({
            label: v.name,
            value: v.id
        })
    }
];
